<template>
   <div class="school">
        <h2>学校名称{{schoolName}}</h2>
        <h2>学校地址{{schoolAdress}}</h2>
        <!-- <button ></button> -->
    </div>    
</template>

<script>
    import pubsub from 'pubsub-js'
     export default({
        name:'School',
        data() {
            return {
                schoolName:'Liuweiwei',
                schoolAdress:'bj'
            }
        },
        // methods: {
        //     showInfo(){

        //     }
        // },
        mounted(){
            // console.log(this);
            // this.$bus.$on('wei',(data)=>{
            //     console.log('收到学生姓名！！！'+data);
            // })
            this.pubid = pubsub.subscribe('weiwei',(msgName,data)=>{
                console.log(data);
            })
        },
        beforeDestroy() {
            // this.$bus.$off('wei')
            pubsub.unsubscribe(this.pubid)
        },
    })
   
</script>

<style>
    .school{
        background-color: orange;
    }
</style>